#pragma once
#include <string>
#include <vector>
#include <map>
#include <stdexcept>
#include "IMDBFileHeader.h"
#include "Movie.h"
#include "Actor.h"

using namespace std;

class MovieDatabase
{
#pragma region Public Methods
public:
   MovieDatabase(void);
   ~MovieDatabase(void);

   vector<Movie> GetBodyOfWork(const Person& actor);
   vector<Person> SearchActors(const string& name, bool matchFullName);
   vector<Actor> Cast(const Movie& movie);



#pragma region Database managment and statistics

   // Opens the file with the supplied filename and attempts to parse the file
   // as a IMDB data file.
   void ImportIMDBFile(const string& filename) throw (invalid_argument);
   int MovieCount() const;
   int ActorCount() const;

#pragma endregion
#pragma endregion

#pragma region Private
private:

    typedef map<Movie, vector<Actor> >::iterator MOVIES_ITERATOR;
    typedef map<Person, vector<Movie> >::iterator ACTORS_ITERATOR;

#pragma region Private methods
    bool IsPotentialMatch(const string& name, const Person& person) const;
    bool IsPotentialMatch(const string& name, const Movie& movie) const;
    bool ParseRecord(istream& source);
#pragma endregion

#pragma region Private members
   vector<IMDBFileHeader> movieDBFiles;
   map<Movie, vector<Actor> > movies;
   map<Person, vector<Movie> > actors;
#pragma endregion

#pragma endregion

};

